import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from 'axios'

import nprogress from 'nprogress'

import './plugins/element.js'

import './assets/css/global.css'
import 'font-awesome/css/font-awesome.css'

import RightPanel from '@/components/RightPanel'
import MenuList from '@/components/MenuList'
import NavBar from '@/components/NavBar'

Vue.component('RightPanel', RightPanel)
Vue.component('MenuList', MenuList)
Vue.component('NavBar', NavBar)

Vue.config.productionTip = false

// 配置请求根路径
axios.defaults.baseURL = 'http://127.0.0.1:9000/api/v1'

axios.interceptors.request.use(
  config => {
    nprogress.start()

    // config.headers.Authorization = window.sessionStorage.getItem('token')

    return config
  },
  error => {
    nprogress.done()
    return Promise.reject(error)
  }
)

axios.interceptors.response.use(
  response => {
    nprogress.done()
    return response
  },
  error => {
    nprogress.done()
    return Promise.reject(error)
  }
)

Vue.prototype.$axios = axios
// Vue.filter('localDateFormat', Util.localDateFormat)
// Vue.filter('locaDateTimeFormat', Util.localDateTimeFormat)
// Vue.filter('dateFormat', Util.dateTimeFormat)
// Vue.filter('clear', Util.clear)

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
